#!/bin/bash
#

read -p "请输入服务名称" ps_name

if ! ps -elf |grep $ps_name |grep -v "grep" &> /dev/null; then
	echo "进程${ ps_name }未启动"

else
	pid=$(ps -elf |grep $ps_name |grep -v "grep" &> /dev/null |awk '{print $4}')
	duankou=$(netstat -tunlp |grep mysql |tail -n1 |awk -F: '{print $4}')
	start_time=$(ps -elf |grep mysql |grep -v "grep" |awk '{print $12}')
cat << eof
	$ps_name
	$pid
	$duankou
	$start_time
eof
fi	
